//
//  GHPartnerCollectionViewCell.m
//  GodHorses
//
//  Created by Mac on 2017/11/17.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "TMGPatnerCollectionViewCell.h"
#define imageWith (UIScreenWidth / 2 - 15)
@interface TMGPatnerCollectionViewCell()
@property(nonatomic, strong) UIImageView     *iconImageView;
@property(nonatomic, strong) STLabel         *titleLable;
@property(nonatomic, strong) STLabel         *nameLable;//name 和手机号
@property(nonatomic, strong) STLabel         *phoneLable;
@property(nonatomic, strong) STLabel         *addressLable;
@end
@implementation TMGPatnerCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self configSubView];
    }
    return self;
}
+ (CGFloat)cellHeight{
    return 280;
}
#pragma mark --SubView
- (void)configSubView{
    self.backgroundColor = TM_backgroundColor;
    UIView * whiteView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth / 2 - 15, [TMGPatnerCollectionViewCell cellHeight] - 10)];
    whiteView.backgroundColor = [UIColor whiteColor];
    whiteView.layer.cornerRadius = 5;
    whiteView.clipsToBounds = YES;
    [self addSubview:whiteView];
    
    self.iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, imageWith, 200)];
    self.iconImageView.image = [UIImage imageNamed:@"10"];
    // [self.iconImageView st_showBottomLineAndWitdh:self.iconImageView.st_width - 20];
    self.iconImageView.backgroundColor = [UIColor whiteColor];
    [whiteView addSubview:self.iconImageView];
    
    self.titleLable = [[STLabel alloc] initWithFrame:CGRectMake(3, self.iconImageView.st_bottom + 1, imageWith - 6, 20)
                                                text:@"春熙路金店"
                                           textColor:TM_firstTextColor
                                                font:15
                                         isSizetoFit:NO
                                       textAlignment:NSTextAlignmentLeft];
    self.titleLable.numberOfLines = 0;
    [whiteView addSubview:self.titleLable];
    
    
    self.addressLable = [[STLabel alloc] initWithFrame:CGRectMake(3, self.titleLable.st_bottom + 1, imageWith - 6, 40)
                                                  text:@"成都市天府新区天府五街美年广场12号"
                                             textColor:TM_secendTextColor
                                                  font:14
                                           isSizetoFit:NO
                                         textAlignment:NSTextAlignmentLeft];
    self.addressLable.numberOfLines = 0;
    [whiteView addSubview:self.addressLable];
    
}
- (void)setModel:(TMGPatnerModel *)model
{
    _model = model;
    
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:model.image] placeholderImage:nil];
    
    self.addressLable.text = model.province;
    
    self.titleLable.text = model.name;
    
}

@end

